// Copyright 2022 a.o.smith ALL Rights Reserved
package com.liuxinlong.enums;

/**
 * 缓存关联业务枚举
 *
 * @author liuxinlong@hotwater.com.cn
 * @version 1.0.0
 * @since 2023-02-13
 */
public enum RedisKeyEnum {
    USER_LOGIN_CACHE(1,"dks:user:login:","用户登录"),
    USER_LOGIN_STATUS(2,"dks:user:status:","用户状态"),
    USER_HEADER_INFO_CACHE(3,"dks:user:header:","用户头像"),
    USER_BASE_INFO_CACHE(4,"dks:user:info:","用户基本信息"),
    USER_POINT_INFO_CACHE(5,"dks:user:point:","用户研值信息"),
    FORUM_STATISTICS_CACHE(6,"dks:forum:statistics","统计信息"),
    POINTS_RULES_CACHE(7,"dks:points:rules","积分规则");

    private int value;

    private String key;

    private String name;

    RedisKeyEnum(int value, String key, String name) {
        this.value = value;
        this.key = key;
        this.name = name;
    }

    public int getValue() {
        return value;
    }
    public String getKey() {
        return key;
    }

    public String getName() {
        return name;
    }

    public static String getNameByValue(int value) {
        RedisKeyEnum arrObj[] = RedisKeyEnum.values();
        for (RedisKeyEnum obj : arrObj) {
            if (value == obj.getValue()) {
                return obj.getName();
            }
        }
        return " ";
    }

    public static String getKeyByValue(int value) {
        RedisKeyEnum arrObj[] = RedisKeyEnum.values();
        for (RedisKeyEnum obj : arrObj) {
            if (value == obj.getValue()) {
                return obj.getKey();
            }
        }
        return " ";
    }
}
